<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="<s:url value="/css/style.css"/>" rel="stylesheet"
			type="text/css" />
		<link href="<s:url value="/css/jquery.css"/>" rel="stylesheet"
			type="text/css" />
		<script type="text/javascript" src="<s:url value="/js/jquery.js"/>"></script>
		<script type="text/javascript" src="<s:url value="/js/jquery-ui.js"/>"></script>
		<script type="text/javascript" src="<s:url value="/js/common.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.bgiframe.min.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.ajaxQueue.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/thickbox-compressed.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.autocomplete.js"/>"></script>
		<link rel="stylesheet" type="text/css"
			href="<s:url value="/js/autocomplete/jquery.autocomplete.css"/>" />
		<script type="text/javascript" src="<s:url value="/js/jquery-ui.js"/>"></script>
		<link rel="stylesheet" type="text/css"
			href="<s:url value="/js/autocomplete/thickbox.css"/>" />
		<script type="text/javascript"
			src="<s:url value="/js/jquery.blockUI.js"/>"></script>
		<script type="text/javascript">
       	function goBack(){
			location.href='<s:url value="/clt/CorpPay/list"/>';
		};
		 $(function(){
	 	 	$('#payTime').datepicker({dateFormat:'yy-mm-dd'});
			$('#refTime').datepicker({dateFormat:'yy-mm-dd'});
		 });
		function doPay() {
		    var pay=$("#payMoney").val();
	     	var reg = new RegExp("^[0-9]+(.[0-9]{2})?$", "g");
		    if (!pay||!reg.test(pay)) {
			    alert("please input payMoney");
			    return;
	     	};
		    if (!confirm("after pay you can't change everything,confirm!")){
		            return;
		    }
		    $('#editForm').submit();
	    };
	    function doRefund() {
	        var ref=$("#refMoney").val();
	     	var reg = new RegExp("^[0-9]+(.[0-9]{2})?$", "g");
		    if (!ref||!reg.test(ref)) {
			    alert("please input money");
			    return;
	     	};
		    if (!confirm("after refund you can't change everything,confirm!")){
		           return;
		    }
		    var form = $('#editForm');
 		    form.attr('action',form.attr('action').replace('pay','refund'));
		    $('#editForm').submit();
	    };
		</script>
		<s:head />
		<title><s:text name="system.title" /></title>
	</head>
	<body>
		<s:include value="/common/up.jsp"></s:include>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td class="box">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td id="tag-over">
								<span id="tag-over">PersonalPay</span>
							</td>
							<td class="tab3-line" width="90%">
								&nbsp;
							</td>
						</tr>
					</table>
					<s:form action="CorpPay/pay" namespace="/clt" method="post"
						id="editForm" name="editForm">
						<s:hidden name="id"></s:hidden>
						<table width="100%" border="0" cellpadding="3" cellspacing="1"
							class="margin">
							<tr>
								<td align="right" class="tablecolour5">
									Name:
								</td>
								<td class="tablecolour5" colspan="3">
									<input id="selstudent" size="40" type="text"
										readonly='readonly' disabled="disabled"
										value="<s:property value="company.name"/>" />
									<s:hidden id="selCompanyId" name="selCompanyId" />
								</td>
							</tr>
							<tr>
								<td align="right" class="tablecolour5">
									Contract No:
								</td>
								<td class="tablecolour5">
									<s:property value="contractNo" />
								</td>
								<td align="right" class="tablecolour5">
									Price:
								</td>
								<td class="tablecolour5">
									<s:property value="price" />
									&nbsp;
									<s:property value="payMethod" />
								</td>
							</tr>
							<tr>
								<td align="right" class="tablecolour5">
									Testing Fee:
								</td>
								<td class="tablecolour5">
									<s:property value="testingFee" />
								</td>
								<td align="right" class="tablecolour5">
									Transportation Fee:
								</td>
								<td class="tablecolour5">
									<s:property value="transportationFee" />
								</td>
							</tr>
							<tr>
								<td align="right" class="tablecolour5">
									Material Fee:
								</td>
								<td class="tablecolour5">
									<s:property value="materialFee" />
								</td>
								<td align="right" class="tablecolour5">
									Training Fee:
								</td>
								<td class="tablecolour5">
									<s:property value="trainingFee" />
								</td>
							</tr>
							<tr>
								<td align="right" class="tablecolour5">
									Begin:
								</td>
								<td class="tablecolour5">
									<s:date name="startTime" format="yyyy-MM-dd" />
								</td>
								<td align="right" class="tablecolour5">
									End:
								</td>
								<td class="tablecolour5">
									<s:date name="endTime" format="yyyy-MM-dd" />
								</td>
							</tr>
							<tr>
							   <td align="right" class="tablecolour5">
									Course Type:
								</td>
								<td class="tablecolour5">
									<s:property value="course" />
								</td>
								<td align="right" class="tablecolour5">
									Comment:
								</td>
								<td class="tablecolour5" >
									<s:property value="comments" />
								</td>
							</tr>
							<tr>
								<td align="right" class="tablecolour5">
									Paid:
								</td>
								<td class="tablecolour5">
									<s:property value="paidMoney" />
								</td>
								<td align="right" class="tablecolour5">
									Pay History:
								</td>
								<td class="tablecolour5">
									<table align="center" width="100%" border="0" cellpadding="0"
										cellspacing="1" class="box2">
										<tr>
											<td class="tablecolour1">
												Type
											</td>
											<td class="tablecolour1">
												Pay
											</td>
											<td class="tablecolour1">
												Time
											</td>
											<td class="tablecolour1">
												Comment
											</td>
										</tr>
										<s:iterator value="corpPayHistoryList" status="status">
											<tr>
												<td class="tablecolour2">
													<s:property value="payType" />
												</td>
												<td class="tablecolour2">
													<s:property value="pay" />
												</td>
												<td class="tablecolour2">
													<s:date name="payTime" format="yyyy-MM-dd" />
												</td>
												<td class="tablecolour2">
													<s:property value="comments" />
												</td>
											</tr>
										</s:iterator>
									</table>
								</td>
							</tr>
							<tr>
								<td align="right" class="tablecolour5">
									Pay:
								</td>
								<td class="tablecolour5"  >
									<s:textfield id="payMoney" name="payMoney" />
									Date:
									<s:textfield id="payTime"   name="payTime"  cssClass="input2 required" />
									<br />
									<input type="button" value="Pay" onclick="doPay();" />
								</td>
								<td align="right" class="tablecolour5">
									Comment:
								</td>
								<td class="tablecolour5"  >
									<s:textarea name="payComment" rows="4" cols="30" />
								</td>
							</tr>
							<tr>
								<td align="right" class="tablecolour5">
									Refundment:
								</td>
								<td class="tablecolour5">
									<s:textfield id="refMoney" name="refMoney" />
									Date:
									<s:textfield id="refTime"   name="refTime"  cssClass="input2 required" />
									<br />
									<input type="button" value="Refund" onclick="doRefund();" />
								</td>
								<td align="right" class="tablecolour5">
									Refund Comment:
								</td>
								<td class="tablecolour5">
									<s:textarea name="refComment" rows="4" cols="30" />
								</td>
							</tr>
							<tr>
								<td align="center" colspan="4" height="50" class="tablecolour5">
									<input name="goback" type="button" class="btn1" value="Go Back"
										onclick="goBack()" />
								</td>
							</tr>
						</table>
						 <table align="center" width="100%" border="0" cellpadding="0"
							cellspacing="1" class="box2">
							<tr>
								<td class="tablecolour1">
									ClassType
								</td>
								<td class="tablecolour1">
									Teacher
								</td>
								<td class="tablecolour1">
									Begin
								</td>
								<td class="tablecolour1">
									End
								</td>
								<td class="tablecolour1">
									Comment
								</td>
							</tr>
							<s:iterator value="corpClassList" status="status">
								<tr>
									<td class="tablecolour2">
										<s:property value="classtype.name" />
									</td>
									<td class="tablecolour2">
										<s:property value="teacher.name" />
									</td>
									<td class="tablecolour2">
										<s:date name="startTime" format="yyyy-MM-dd" />
									</td>
									<td class="tablecolour2">
										<s:date name="endTime" format="yyyy-MM-dd" />
									</td>
									<td class="tablecolour2">
										<s:property value="comments" />
									</td>
								</tr>
							</s:iterator>
						</table>
					</s:form>
				</td>
			</tr>
		</table>
		<s:include value="/common/down.jsp"></s:include>
		<div id='pop-div' style="width: 300px;" class="pop-box">
			<s:include value="/common/confirm.jsp"></s:include>
		</div>
	</body>
</html>